package com.wolfalpha.lwtool.constant;

import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.wolfalpha.lwtool.vo.FFCity;

/**
 * 常量
 * 
 * @author ttStudio yimi
 *         {"code":200,"codeInfo":"","data":{"citys":[{"id":120,"isExpress"
 *         :0,"letter"
 *         :"A","name":"安庆市"},{"id":34,"isExpress":0,"letter":"B","name"
 *         :"北京市"},{"id":121,"isExpress":0,"letter":"B","name":"蚌埠市"},{"id":237,
 *         "isExpress"
 *         :0,"letter":"C","name":"成都市"},{"id":37,"isExpress":0,"letter"
 *         :"C","name"
 *         :"重庆市"},{"id":201,"isExpress":0,"letter":"C","name":"长沙市"},
 *         {"id":217,"isExpress"
 *         :0,"letter":"G","name":"广州市"},{"id":129,"isExpress"
 *         :0,"letter":"H","name"
 *         :"黄山市"},{"id":126,"isExpress":1,"letter":"H","name"
 *         :"合肥市"},{"id":109,"isExpress"
 *         :0,"letter":"H","name":"杭州市"},{"id":160,"isExpress"
 *         :0,"letter":"J","name"
 *         :"济南市"},{"id":131,"isExpress":0,"letter":"M","name"
 *         :"马鞍山市"},{"id":114,
 *         "isExpress":0,"letter":"N","name":"宁波市"},{"id":150,
 *         "isExpress":0,"letter"
 *         :"N","name":"南昌市"},{"id":99,"isExpress":0,"letter"
 *         :"N","name":"南京市"},{
 *         "id":165,"isExpress":0,"letter":"Q","name":"青岛市"},
 *         {"id":101,"isExpress"
 *         :0,"letter":"S","name":"苏州市"},{"id":228,"isExpress"
 *         :0,"letter":"S","name"
 *         :"深圳市"},{"id":36,"isExpress":0,"letter":"S","name"
 *         :"上海市"},{"id":38,"isExpress"
 *         :0,"letter":"S","name":"石家庄市"},{"id":56,"isExpress"
 *         :0,"letter":"T","name"
 *         :"太原市"},{"id":35,"isExpress":0,"letter":"T","name"
 *         :"天津市"},{"id":198,"isExpress"
 *         :0,"letter":"W","name":"武汉市"},{"id":134,"isExpress"
 *         :0,"letter":"W","name"
 *         :"芜湖市"},{"id":285,"isExpress":0,"letter":"X","name"
 *         :"西安市"},{"id":188,"isExpress"
 *         :0,"letter":"Z","name":"郑州市"}],"hot":[{"id"
 *         :126,"isExpress":1,"letter":"H","name":"合肥市"}]},"dataId":0}
 * 
 *         yimi{ list
 *         http://121.40.132.184:80/v1/api/stu/job/home/list?cityId=99
 *         &lat=31.882587&lon=118.826641
 *         http://121.40.132.184:80/v1/api/stu/job/
 *         list?cityId=99&jobTypeId=0&km=
 *         0&lat=31.882534&lon=118.826613&pageNum=1&pageSize=20&sort=0 详细工作
 *         http://121.40.132.184:80/v1/api/stu/job/detail?jobId=77627&stuId=0
 *         商家兼职列表 http://121.40.132.184:80/v1/api/stu/corp/job/list?corpId=76718
 *         商家信息 http://121.40.132.184:80/v1/api/stu/corp/item?corpId=76718 }
 */
public class Constant {
	public static final String encode = "UTF-8";

	public static final List<FFCity> citys = new ArrayList<FFCity>();

	public static final void initCitys() {
		// FFCity fc1 = new FFCity();
		// fc1.setCity("南京市");
		// fc1.setProvince("江苏省");
		// fc1.setId(1600);
		// citys.add(fc1);
		FFCity fc2 = new FFCity();
		fc2.setCity("北京市");
		fc2.setProvince("北京市");
		fc2.setId(200);
		citys.add(fc2);
		FFCity fc3 = new FFCity();
		fc3.setCity("上海市");
		fc3.setProvince("上海市");
		fc3.setId(2000);
		citys.add(fc3);
		FFCity fc4 = new FFCity();
		fc4.setCity("常州市");
		fc4.setProvince("江苏省");
		fc4.setId(700);
		citys.add(fc4);
		FFCity fc5 = new FFCity();
		fc5.setCity("苏州市");
		fc5.setProvince("江苏省");
		fc5.setId(1800);
		citys.add(fc5);
		FFCity fc6 = new FFCity();
		fc6.setCity("杭州市");
		fc6.setProvince("浙江省");
		fc6.setId(1100);
		citys.add(fc6);
		FFCity fc7 = new FFCity();
		fc7.setCity("武汉市");
		fc7.setProvince("湖北省");
		fc7.setId(2400);
		citys.add(fc7);
		FFCity fc8 = new FFCity();
		fc8.setCity("合肥市");
		fc8.setProvince("安徽省");
		fc8.setId(1000);
		citys.add(fc8);

	}

	public static void addCity(List<FFCity> cs) {
		for (FFCity ct : cs) {
			citys.add(ct);
		}
	}

	// 详情URL
	// fafa
	// 列表URL
	// fafa http://app.fafajob.com/parttimeJob/list.do
	public static final String listUrl = "http://app.fafajob.com/parttimeJob/list.do";
	public static final String citysUrl = "http://app.fafajob.com/opencity/list.do";// post
	// competenceCode=w1T01f5AlH5zpGyaQLW9zOVf%2BlcMExInMtzDIgeA2aA%3D%0A&client_type=app_client&
	public static final String infoUrl = "http://app.fafajob.com/parttimeJob/info.do";
	// company
	// 接口地址120.25.229.186
	public static final String serverUrl = "http://120.25.229.186";
	public static final String comUrl = "http://120.25.229.186/jianzhitong/Api/Job/";
	public static final String comLoginUrl = "http://120.25.229.186/jianzhitong/Api/User/login";
	// admin
	// base
	// public static final String adminBaseUrl =
	// "http://2.jianzhibaobei.sinaapp.com/index.php/Home/Admin/";
	public static final String adminBaseUrl = "http://120.25.229.186/jianzhitong/index.php/Home/Admin/";
	public static final String adminLoginUrl = adminBaseUrl
			+ "login?format=json";// post:mobile/email
	public static final String adminLogoutUrl = adminBaseUrl
			+ "logout?format=json";// post
	public static final String adminGetCountUrl = adminBaseUrl
			+ "getCountInfo?format=json";// 统计信息get
	public static final String adminIndexJobUrl = adminBaseUrl
			+ "index?format=json";// 待审核兼职get
	public static final String adminIndexComUrl = adminBaseUrl
			+ "comList?format=json";// 待审核企业get
	public static final String adminJobUrl = adminBaseUrl + "job?format=json";// 兼职详情get:id
	public static final String adminComInfoUrl = adminBaseUrl
			+ "company?format=json";// 企业信息get:id
	/**
	 * isPass不能为空；不通过时，必须有reason且不为0，若reason=0,则必须有detail且不为空；删除无要求。
	 * 用户未填写Email时仍返回true,提示邮件发送失败
	 */
	/**
	 * id(兼职ID), isPass（0：不通过1：通过；3：删除）,
	 * reason（0：其他（服务器只对0和空做了判断，其余为文本）、兼职信息填写不详细、兼职信息填写不真实、联系人电话无效或无人接听、疑似虚假兼职）,
	 * detail（文本）
	 */
	public static final String adminAuditeJobUrl = adminBaseUrl + "auditeJob/";// 审核兼职get
	/**
	 * id(企业ID), isPass(1:通过，2：不通过),
	 * reason(0:其他（服务器只对0和空做了判断，其余为文本）、上传营业执照不清晰、企业信息不完善、联系人电话无效), detail（文本）
	 */
	public static final String adminAuditeComUrl = adminBaseUrl + "auditeCom/";// 审核企业get

	// 列表Post
	// fafa
	@SuppressWarnings("deprecation")
	public static Map<String, String> getHeadMap(FFCity fct) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("competenceCode",
				"w1T01f5AlH5zpGyaQLW9zOVf%2BlcMExInMtzDIgeA2aA%3D%0A");
		map.put("provincesName", URLEncoder.encode(fct.getProvince())
				.toString());// %E6%B1%9F%E8%8B%8F%E7%9C%81
		map.put("cityName", URLEncoder.encode(fct.getCity()).toString());// %E5%8D%97%E4%BA%AC%E5%B8%82
		map.put("pjType", "ordinary");
		map.put("apiType", "index");
		map.put("sign", "612303b8e1ef25981a5178b3d3ef8ad");
		map.put("longitude", "118.781809");
		map.put("latitude", "32.050058");
		map.put("client_type", "app_client");
		map.put("jobNature", "");
		map.put("paymentMeans", "");
		map.put("jobType", "");
		return map;
	}

	/**
	 * 更多Post fafa
	 * 
	 * @param bid
	 *            最下面的id
	 * @return
	 */
	@SuppressWarnings("deprecation")
	public static Map<String, String> getMoreMap(int bid, FFCity fct) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("competenceCode",
				"w1T01f5AlH5zpGyaQLW9zOVf%2BlcMExInMtzDIgeA2aA%3D%0A");
		map.put("provincesName", URLEncoder.encode(fct.getProvince())
				.toString());// %E6%B1%9F%E8%8B%8F%E7%9C%81
		map.put("cityName", URLEncoder.encode(fct.getCity()).toString());// %E5%8D%97%E4%BA%AC%E5%B8%82
		map.put("pjType", "ordinary");
		map.put("apiType", "more");
		map.put("sign", "d18d43e79b62b6cd12f60a0708639222");
		map.put("longitude", "118.781809");
		map.put("latitude", "32.050058");
		map.put("client_type", "app_client");
		map.put("jobNature", "");
		map.put("paymentMeans", "");
		map.put("jobType", "");
		map.put("moreId", String.valueOf(bid));
		return map;
	}

	/**
	 * 刷新Post fafa
	 * 
	 * @param tid
	 *            最上面的id
	 * @return
	 */
	@SuppressWarnings("deprecation")
	public static Map<String, String> getRefreshMap(int tid, FFCity fct) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("competenceCode",
				"w1T01f5AlH5zpGyaQLW9zOVf%2BlcMExInMtzDIgeA2aA%3D%0A");
		map.put("provincesName", URLEncoder.encode(fct.getProvince())
				.toString());// %E6%B1%9F%E8%8B%8F%E7%9C%81
		map.put("cityName", URLEncoder.encode(fct.getCity()).toString());// %E5%8D%97%E4%BA%AC%E5%B8%82
		map.put("pjType", "ordinary");
		map.put("apiType", "refresh");
		map.put("sign", "16b4c1a2aaa94a649a1f4682415a286c");
		map.put("longitude", "118.781809");
		map.put("latitude", "32.050058");
		map.put("client_type", "app_client");
		map.put("jobNature", "");
		map.put("paymentMeans", "");
		map.put("jobType", "");
		map.put("refreshId", String.valueOf(tid));
		return map;
	}

	// 详情Post
	// fafa
	public static Map<String, String> getInfoMap(String id) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("pjId", id);
		map.put("client_type", "app_client");
		return map;
	}

}
